﻿--
-- Dropping stored procedure pr_ChiTietPhieuNhap_SelectAll : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_ChiTietPhieuNhap_SelectAll]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_ChiTietPhieuNhap_SelectAll]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_ChiTietPhieuNhap_SelectAll
-- Author:	MinhNN
-- Create date:	5/14/2012 9:58:06 PM
-- Description:	This stored procedure is intended for selecting all rows from ChiTietPhieuNhap table
-- ==========================================================================================
Create Procedure pr_ChiTietPhieuNhap_SelectAll
As
Begin
	Select 
		[MaPhieuNhap],
		[MaHH],
		[SoLuong]
	From ChiTietPhieuNhap
End

GO


--
-- Dropping stored procedure pr_ChiTietPhieuNhap_SelectRow : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_ChiTietPhieuNhap_SelectRow]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_ChiTietPhieuNhap_SelectRow]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_ChiTietPhieuNhap_SelectRow
-- Author:	MinhNN
-- Create date:	5/14/2012 9:58:06 PM
-- Description:	This stored procedure is intended for selecting a specific row from ChiTietPhieuNhap table
-- ==========================================================================================
Create Procedure pr_ChiTietPhieuNhap_SelectRow
	@MaPhieuNhap varchar(10),
	@MaHH varchar(10)
As
Begin
	Select 
		[MaPhieuNhap],
		[MaHH],
		[SoLuong]
	From ChiTietPhieuNhap
	Where
		[MaPhieuNhap] = @MaPhieuNhap
		and [MaHH] = @MaHH
End

GO


--
-- Dropping stored procedure pr_ChiTietPhieuNhap_Insert : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_ChiTietPhieuNhap_Insert]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_ChiTietPhieuNhap_Insert]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_ChiTietPhieuNhap_Insert
-- Author:	MinhNN
-- Create date:	5/14/2012 9:58:06 PM
-- Description:	This stored procedure is intended for inserting values to ChiTietPhieuNhap table
-- ==========================================================================================
Create Procedure pr_ChiTietPhieuNhap_Insert
	@MaPhieuNhap varchar(10),
	@MaHH varchar(10),
	@SoLuong int
As
Begin
	Insert Into ChiTietPhieuNhap
		([MaPhieuNhap],[MaHH],[SoLuong])
	Values
		(@MaPhieuNhap,@MaHH,@SoLuong)

End

GO


--
-- Dropping stored procedure pr_ChiTietPhieuNhap_Update : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_ChiTietPhieuNhap_Update]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_ChiTietPhieuNhap_Update]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_ChiTietPhieuNhap_Update
-- Author:	MinhNN
-- Create date:	5/14/2012 9:58:06 PM
-- Description:	This stored procedure is intended for updating ChiTietPhieuNhap table
-- ==========================================================================================
Create Procedure pr_ChiTietPhieuNhap_Update
	@MaPhieuNhap varchar(10),
	@MaHH varchar(10),
	@SoLuong int
As
Begin
	Update ChiTietPhieuNhap
	Set
		[SoLuong] = @SoLuong
	Where		
		[MaPhieuNhap] = @MaPhieuNhap
		and [MaHH] = @MaHH

End

GO


--
-- Dropping stored procedure pr_ChiTietPhieuNhap_DeleteRow : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_ChiTietPhieuNhap_DeleteRow]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_ChiTietPhieuNhap_DeleteRow]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_ChiTietPhieuNhap_DeleteRow
-- Author:	MinhNN
-- Create date:	5/14/2012 9:58:06 PM
-- Description:	This stored procedure is intended for deleting a specific row from ChiTietPhieuNhap table
-- ==========================================================================================
Create Procedure pr_ChiTietPhieuNhap_DeleteRow
	@MaPhieuNhap varchar(10),
	@MaHH varchar(10)
As
Begin
	Delete ChiTietPhieuNhap
	Where
		[MaPhieuNhap] = @MaPhieuNhap
		and [MaHH] = @MaHH

End

GO
